﻿using Aluetjen.EmailService.Domain.Models.Message;
using Aluetjen.EmailService.Domain.Models.Pipeline;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Aluetjen.EmailService.Domain.Tests.Models.Pipeline
{
    [TestClass]
    public class TransformationTests
    {
        [TestMethod]
        public void TransformMessage_Should_Prefix_Subject()
        {
            var transform = new Transformation
                                {
                                    Field = MessageField.Subject,
                                    MatchRegex = @"\A",
                                    ReplacementRegex = @"[STAGING] "
                                };
            var message = new MailMessage
                              {
                                  Subject = "Some subject text",
                                  Body = "Body"
                              };

            transform.TransformMessage(message);

            Assert.AreEqual("[STAGING] Some subject text", message.Subject);
        }
    }
}
